home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / m_to_r / roppop / troppop.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  3.6 KB  |  144 lines

  1. unit Troppop;
  2. { TRopPop 1.0  (c) 1995 by Eyal Frank
  3.   Tel Aviv
  4.   Israel
  5.   CIS : 100274,3376
  6.   EMail frank-e@Trendline.co.il
  7.  
  8.   This is my first component , i realy want to get any feedback,
  9.   So drop me an Email please.
  10.  
  11.   This is a simple component to display a modal Window with the cool shadow effect
  12.   i'd get the basic idea from MSDN  (i don't remember the actual program)
  13.  
  14.  
  15.   TRopPop is FreeWare. You may use it freely at your own risk in any
  16.   kind of environment. This component is not to be sold at any charge, and
  17.   must be distributed along with the source code and this copyright header.
  18.  
  19.  
  20.   property Brush
  21.            TBrush , the Window BackGround.
  22.  
  23.   property Font : TFont
  24.            The font of the text. Note that the window will Autosize to
  25.            fit the size of the string .
  26.  
  27.   property Lines: TStrings
  28.            Where u store the actual String(s)
  29.  
  30.   property TimeClose:Integer (ms)
  31.           if u want that the window will auto close himself ,Set this property
  32.           to the amount of mSecs. for example 1000 will close after one sec.
  33.           if 0, then no auto close.
  34.   property xPos,yPos :Integer
  35.           the x and y coordinates of top left of win whn execute.
  36.           if set to 0,then it will center.
  37.  
  38.   procedure Fire
  39.          Like Execute. this proc will open the window and wait until user's
  40.          any key down or click.(or auto close as above)
  41.  
  42.  
  43.  
  44. }
  45.  
  46.  
  47. interface
  48.  
  49. uses
  50.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  51.   Forms, Dialogs,RopWin;
  52.  
  53. type
  54.   TRopWin = class(TComponent)
  55.   private
  56.   FormDlg:TRopInst;
  57.   FBrush:TBrush;
  58.   FFont:TFont;
  59.   FLines:TStrings;
  60.   FTimeClose:Integer;
  61.   FXPos:Integer;
  62.   FYPos:Integer;
  63.   procedure SetLines(Value: TStrings);
  64.   procedure SetFont(Value:TFont);
  65.   procedure SetBrush(Value: TBrush);
  66.   protected
  67.     { Protected declarations }
  68.   public
  69.     constructor Create(AOwner: TComponent); override;
  70.     destructor Destroy; override;
  71.     procedure Fire;
  72.   published
  73.     property Brush:TBrush read FBrush write SetBrush;
  74.     property Font:TFont read FFont write SetFont;
  75.     property Lines:TStrings read FLines write SetLines;
  76.     property TimeClose:Integer read FTimeClose write FTimeClose;
  77.     property xPos: Integer read FXPos write FXPos;
  78.     property yPos:Integer read FYPos write FYPos;
  79.   end;
  80.  
  81. procedure Register;
  82.  
  83. implementation
  84. constructor TRopWin.Create(AOwner: TComponent);
  85. begin
  86.    inherited Create(AOwner);
  87.    FormDlg:=nil;
  88.    FXPos:=0;
  89.    FYPos:=0;
  90.    FTimeClose:=0;
  91.    FLines:=TStringList.Create;
  92.    FBrush:=TBrush.Create;
  93.    FFont:=TFont.Create;
  94. end;
  95. destructor TRopWin.Destroy;
  96. begin
  97.    inherited Destroy;
  98.    FLines.Free;
  99.    FFont.Free;
  100.    FBrush.Free;
  101. end;
  102. procedure TRopWin.Fire;
  103. begin
  104.     if FLines.Count < 1 then
  105.     begin
  106.        MessageBox(Application.Handle,'The Lines is empty','Error',MB_OK);
  107.        Exit;
  108.     end;
  109.     FormDlg:=TRopInst.Create(Application);
  110.     try
  111.       {FormDlg.Parent:=Self;}
  112.       FormDlg.Font.Assign(FFont);
  113.       FormDlg.formBrush.Assign(FBrush);
  114.       FormDlg.sText.Assign(FLines);
  115.       FormDlg.xPos:=FXPos;
  116.       FormDlg.yPos:=FYPos;
  117.       FormDlg.timerClose:=FTimeClose;
  118.       FormDlg.DoInit;
  119.       FormDlg.ShowModal;
  120.     finally
  121.       FormDlg.Free;
  122.       FormDlg:=nil;
  123.     end;
  124. end;
  125. procedure TRopWin.SetLines(Value: TStrings);
  126. begin
  127.   FLines.Assign(Value);
  128. end;
  129. procedure TRopWin.SetFont(Value: TFont);
  130. begin
  131.   FFont.Assign(Value);
  132. end;
  133. procedure TRopWin.SetBrush(Value: TBrush);
  134. begin
  135.   FBrush.Assign(Value);
  136. end;
  137.  
  138. procedure Register;
  139. begin
  140.   RegisterComponents('Dialogs', [TRopWin]);
  141. end;
  142.  
  143. end.
  144.